import Vue from 'vue';
// 重置样式 不同的浏览器在渲染网页元素的时候形式更统一
import 'normalize.css/normalize.css'; // A modern alternative to CSS resets

import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
// import locale from 'element-ui/lib/locale/lang/en' // lang i18n internationalization 国际化 多语言
// 和Less差不多 预处理语言
// $ 清浮动 mixin 类似函数 @mixin @include
import '@/styles/index.scss'; // global css

import App from './App'; // 根组件
import store from './store'; // vuex
import router from './router'; // 路由代码

import '@/icons'; // icon
import '@/permission'; // permission control

/**
 * If you don't want to use mock-server
 * you want to use MockJs for mock api
 * you can execute: mockXHR()
 *
 * Currently MockJs will be used in the production environment,
 * please remove it before going online ! ! !
 */
// if (process.env.NODE_ENV === 'production') {
//   const { mockXHR } = require('../mock')
//   mockXHR()
// }

// set ElementUI lang to EN
// Vue.use(插件)
Vue.use(ElementUI, {
  i18n: (key, value) => i18n.t(key, value),
});
// 如果想要中文版 element-ui，按如下方式声明
// Vue.use(ElementUI)

Vue.config.productionTip = false;

// 批量注册全局指令
import * as directives from './directives';
Object.keys(directives).forEach((key) => {
  Vue.directive(key, directives[key]);
});

import * as filters from './filters';
Object.keys(filters).forEach((key) => {
  Vue.filter(key, filters[key]);
});

import Component from '@/components';
Vue.use(Component);

import Print from 'vue-print-nb';

Vue.use(Print);

import checkPermission from './mixin/checkPermission';
Vue.mixin(checkPermission);
import i18n from './lang';
new Vue({
  el: '#app',
  router,
  store,
  i18n,
  render: (h) => h(App),
});
